package com.iplant.mes.service.po.qms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.pdm.service.basicenum.pdm.PDMComponentTypes;

/**
 * 产品工件
 */
@DBBasePO(TableName = "bcm_rule", Schemas = DBSchemas.MES,
        CheckName = {"Code", "ComponentType,Name"}, CodeAuto = true, CodePrefix = "BCMR-")
public class QMSWorkpiece extends BasePO {

    @DBCondition
    @DBField
    public int ComponentType = 0;

    public String ComponentTypeText = "";

    /**
     * 规则字符串  暂时仅支持前缀固定 生成后续
     */

    public String RuleString = "";

    /**
     * 序列号长度
     */
    public String SNLength = "";



    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ComponentTypeText")
    public String getComponentTypeText() {
        ComponentTypeText = PDMComponentTypes.getEnumType(ComponentType).getLabel();
        return ComponentTypeText;
    }

    public void setComponentTypeText(String componentTypeText) {
        ComponentTypeText = componentTypeText;
    }

    @JsonProperty("RuleString")
    public String getRuleString() {
        return RuleString;
    }

    public void setRuleString(String ruleString) {
        RuleString = ruleString;
    }
    @JsonProperty("SNLength")
    public String getSNLength() {
        return SNLength;
    }

    public void setSNLength(String SNLength) {
        this.SNLength = SNLength;
    }

}
